#if !defined(__Gomoku_GameInfo_h)
#define __Gomoku_GameInfo_h

#include "GomokuBitmask.h"

#define SWITCHPLAYER(x)		(x == 1 ? -1 : 1)
#define LENGTHBOARD		19
#define CURRENTPLAYERWHITE	0
#define CURRENTPLAYERBLACK	1
#define ADDCURRENTPLAYER(x)	((x == CURRENTPLAYERWHITE ? WHITE : 0) + ISNTEMPTY)


typedef struct{
	int x;
	int y;
} coord_t;

enum	Way
{
	NORTH,
	SOUTH,
	EAST,
	WEST,
	NORTHWEST,
	NORTHEAST,
	SOUTHWEST,
	SOUTHEAST
};

#define INCCOORDSOUTHEAST(x, y, w) (w == SOUTHEAST ? x++, y++ : 0)
#define INCCOORDSOUTHWEST(x, y, w) (w == SOUTHWEST ? x--, y++ : INCCOORDSOUTHEAST(x, y, w))
#define INCCOORDNORTHEAST(x, y, w) (w == NORTHEAST ? x++, y-- : INCCOORDSOUTHWEST(x, y, w))
#define INCCOORDNORTHWEST(x, y, w) (w == NORTHWEST ? x--, y-- : INCCOORDNORTHEAST(x, y, w))
#define INCCOORDWEST(x, y, w) (w == WEST ? x-- : INCCOORDNORTHWEST(x, y, w))
#define INCCOORDEAST(x, y, w) (w == EAST ? x++ : INCCOORDWEST(x, y, w))
#define INCCOORDSOUTH(x, y, w) (w == SOUTH ? y++ : INCCOORDEAST(x, y, w))
#define INCCOORD(x, y, w) (w == NORTH ? y-- : INCCOORDSOUTH(x, y, w))

class GameInfo
{		
	int**	_map;
	char	_score[2];
	char	_currentPlayer; /* 0 = white, 1 = black */
		
public:
	GameInfo(void);
	GameInfo(GameInfo&);
	~GameInfo(void);

	int**	getMap(void);
	char	getCurrentPlayer(void);
	char*	getScore(void);

	void	putPieceOnMap(coord_t&);
	void	takeOffPieceOnBoard(int y, int x, Way way);
	int		initMask(int y, int x);
	void	incScore(char c);
	void	endRoundOfPlayer(void);
};

	

#endif